import * as Cesium from '@cesium/Source/Cesium.js';

// https://www.cnblogs.com/cesiumjs/p/10963634.html

let {
  Matrix4,
  Cartesian2,
  Cartesian3,
  Color
} = Cesium;
let {
  ParticleSystem,
  BoxEmitter,
  CircleEmitter,
  ConeEmitter,
  SphereEmitter
} = Cesium;
let {
  ParticleBurst
} = Cesium;

const cfgDef = {
  image: './data/smoke.png',
  imageSize: new Cartesian2(20, 20),
  startScale: 1.0,
  endScale: 4.0,
  // color: Color.MAGENTA,
  particleLife: 1.0,
  speed: 5.0,
  emitter: new ConeEmitter(Cesium.Math.toRadians(30.0)),
  emissionRate: 5.0,
  // modelMatrix : entity.computeModelMatrix(viewer.clock.startTime, new Matrix4()),
  lifetime: 16.0
}

export function createParticleSystem(opt = {}) {
  opt = {
    ...cfgDef,
    ...opt
  };
  return new ParticleSystem(opt)
}
